Page({
    data: {
      expert: {},
      currentType: 'text' // 默认图文咨询
    },
  
    onLoad(options) {
      const expertId = options.id;
      // 模拟请求专家详情数据
      this.fetchExpertDetail(expertId);
    },
  
    // 模拟获取专家详情
    fetchExpertDetail(id) {
      // 实际项目中替换为接口请求
      const expertData = {
        id: 1,
        avatar: '/assets/images/my/avatar.jpg',
        name: '张正畸',
        title: '主任医师',
        department: '正畸科',
        intro: '从事正畸临床工作15年，擅长各类牙齿畸形矫正，尤其在隐形矫正领域有丰富经验，已帮助2000+患者解决牙齿问题。',
        skills: ['隐形矫正', '儿童正畸', '牙齿不齐', '地包天矫正'],
        rating: 4.9,
        reviewCount: 126,
        textPrice: '免费',
        voicePrice: '¥50/次',
        reviews: [
          {
            id: 1,
            userName: '患者A',
            avatar: '/assets/images/my/avatar.jpg',
            starCount: 5,
            content: '张医生很专业，解答了我关于隐形矫正的所有疑问，现在矫正效果很好！',
            time: '2024-03-15'
          },
          {
            id: 2,
            userName: '患者B',
            avatar: '/assets/images/my/avatar.jpg',
            starCount: 4,
            content: '医生态度很好，耐心讲解了孩子正畸的注意事项，非常感谢！',
            time: '2024-02-28'
          }
        ]
      };
  
      this.setData({ expert: expertData });
    },
  
    // 切换咨询类型
    onTypeChange(e) {
      const type = e.currentTarget.dataset.type;
      this.setData({ currentType: type });
    },
  
    // 跳转到发起咨询页
    goToConsultForm() {
    //   const { id, name } = this.data.expert;
    //   wx.navigateTo({
    //     url: `/pages/consultForm/consultForm?id=${id}&name=${name}&type=${this.data.currentType}`
    //   });
    wx.navigateTo({
      url: '/pages/business/consultForm/consultForm',
    })
    }
  });